Import Module


In [1]:
import sys
import textwrap
names = sorted(sys.modules.keys())
name_text = ', '.join(names)
print(textwrap.fill(name_text, width=64))


IPython, IPython.core, IPython.core.alias,
IPython.core.application, IPython.core.autocall,
IPython.core.builtin_trap, IPython.core.compilerop,
IPython.core.completer, IPython.core.completerlib,
IPython.core.crashhandler, IPython.core.debugger,
IPython.core.display, IPython.core.display_trap,
IPython.core.displayhook, IPython.core.displaypub,
IPython.core.error, IPython.core.events, IPython.core.excolors,
IPython.core.extensions, IPython.core.formatters,
IPython.core.getipython, IPython.core.history,
IPython.core.hooks, IPython.core.inputsplitter,
IPython.core.inputtransformer, IPython.core.interactiveshell,
IPython.core.latex_symbols, IPython.core.logger,
IPython.core.macro, IPython.core.magic,
IPython.core.magic_arguments, IPython.core.magics,
IPython.core.magics.auto, IPython.core.magics.basic,
IPython.core.magics.code, IPython.core.magics.config,
IPython.core.magics.display, IPython.core.magics.execution,
IPython.core.magics.extension, IPython.core.magics.history,
IPython.core.magics.logging, IPython.core.magics.namespace,
IPython.core.magics.osm, IPython.core.magics.pylab,
IPython.core.magics.script, IPython.core.oinspect,
IPython.core.page, IPython.core.payload,
IPython.core.payloadpage, IPython.core.prefilter,
IPython.core.profiledir, IPython.core.pylabtools,
IPython.core.release, IPython.core.shadowns,
IPython.core.shellapp, IPython.core.splitinput,
IPython.core.ultratb, IPython.core.usage, IPython.display,
IPython.extensions, IPython.extensions.storemagic, IPython.lib,
IPython.lib.backgroundjobs, IPython.lib.clipboard,
IPython.lib.deepreload, IPython.lib.display, IPython.lib.pretty,
IPython.lib.security, IPython.paths, IPython.terminal,
IPython.terminal.debugger, IPython.terminal.embed,
IPython.terminal.interactiveshell, IPython.terminal.ipapp,
IPython.terminal.magics, IPython.terminal.prompts,
IPython.terminal.pt_inputhooks, IPython.terminal.ptutils,
IPython.terminal.shortcuts, IPython.testing,
IPython.testing.skipdoctest, IPython.utils,
IPython.utils.PyColorize, IPython.utils._process_common,
IPython.utils._process_posix, IPython.utils._sysinfo,
IPython.utils._tokenize_py3, IPython.utils.capture,
IPython.utils.colorable, IPython.utils.coloransi,
IPython.utils.contexts, IPython.utils.data,
IPython.utils.decorators, IPython.utils.dir2,
IPython.utils.encoding, IPython.utils.frame,
IPython.utils.generics, IPython.utils.importstring,
IPython.utils.io, IPython.utils.ipstruct,
IPython.utils.module_paths, IPython.utils.openpy,
IPython.utils.path, IPython.utils.process,
IPython.utils.py3compat, IPython.utils.sentinel,
IPython.utils.signatures, IPython.utils.strdispatch,
IPython.utils.sysinfo, IPython.utils.syspathcontext,
IPython.utils.tempdir, IPython.utils.terminal,
IPython.utils.text, IPython.utils.timing,
IPython.utils.tokenize2, IPython.utils.tokenutil,
IPython.utils.ulinecache, IPython.utils.wildcard, __future__,
__main__, __mp_main__, _ast, _bisect, _blake2, _bootlocale,
_bz2, _codecs, _collections, _collections_abc, _compat_pickle,
_compression, _ctypes, _curses, _cython_0_25_1, _datetime,
_frozen_importlib, _frozen_importlib_external, _functools,
_hashlib, _heapq, _imp, _io, _json, _locale, _lsprof, _lzma,
_multiprocessing, _opcode, _operator, _osx_support, _pickle,
_posixsubprocess, _random, _sha3, _signal, _sitebuiltins,
_socket, _sqlite3, _sre, _stat, _string, _strptime, _struct,
_sysconfigdata_m_darwin_darwin, _thread, _warnings, _weakref,
_weakrefset, abc, argparse, array, ast, atexit, base64, bdb,
binascii, bisect, builtins, bz2, cProfile, calendar, cmd, code,
codecs, codeop, collections, collections.abc, concurrent,
concurrent.futures, concurrent.futures._base,
concurrent.futures.process, concurrent.futures.thread,
contextlib, copy, copyreg, ctypes, ctypes._endian,
ctypes.macholib, ctypes.macholib.dyld, ctypes.macholib.dylib,
ctypes.macholib.framework, ctypes.util, curses, datetime,
decorator, dis, email, email._parseaddr, email._policybase,
email.base64mime, email.charset, email.encoders, email.errors,
email.feedparser, email.header, email.parser, email.quoprimime,
email.utils, encodings, encodings.aliases, encodings.cp437,
encodings.latin_1, encodings.utf_8, enum, errno, faulthandler,
fcntl, fnmatch, functools, gc, genericpath, getopt, getpass,
gettext, glob, google, grp, hashlib, heapq, hmac, html,
html.entities, imp, importlib, importlib._bootstrap,
importlib._bootstrap_external, importlib.abc,
importlib.machinery, importlib.util, inspect, io, ipykernel,
ipykernel._version, ipykernel.codeutil, ipykernel.comm,
ipykernel.comm.comm, ipykernel.comm.manager, ipykernel.connect,
ipykernel.datapub, ipykernel.displayhook, ipykernel.heartbeat,
ipykernel.iostream, ipykernel.ipkernel, ipykernel.jsonutil,
ipykernel.kernelapp, ipykernel.kernelbase,
ipykernel.parentpoller, ipykernel.pickleutil,
ipykernel.serialize, ipykernel.zmqshell, ipython_genutils,
ipython_genutils._version, ipython_genutils.encoding,
ipython_genutils.importstring, ipython_genutils.path,
ipython_genutils.py3compat, ipython_genutils.text, ipywidgets,
ipywidgets._version, ipywidgets.widgets,
ipywidgets.widgets.domwidget, ipywidgets.widgets.eventful,
ipywidgets.widgets.interaction, ipywidgets.widgets.trait_types,
ipywidgets.widgets.widget, ipywidgets.widgets.widget_bool,
ipywidgets.widgets.widget_box, ipywidgets.widgets.widget_button,
ipywidgets.widgets.widget_color,
ipywidgets.widgets.widget_controller,
ipywidgets.widgets.widget_float,
ipywidgets.widgets.widget_image, ipywidgets.widgets.widget_int,
ipywidgets.widgets.widget_layout,
ipywidgets.widgets.widget_link,
ipywidgets.widgets.widget_output,
ipywidgets.widgets.widget_selection,
ipywidgets.widgets.widget_selectioncontainer,
ipywidgets.widgets.widget_string, itertools, json, json.decoder,
json.encoder, json.scanner, jupyter_client,
jupyter_client._version, jupyter_client.adapter,
jupyter_client.blocking, jupyter_client.blocking.channels,
jupyter_client.blocking.client, jupyter_client.channels,
jupyter_client.channelsabc, jupyter_client.client,
jupyter_client.clientabc, jupyter_client.connect,
jupyter_client.jsonutil, jupyter_client.kernelspec,
jupyter_client.launcher, jupyter_client.localinterfaces,
jupyter_client.manager, jupyter_client.managerabc,
jupyter_client.multikernelmanager, jupyter_client.session,
jupyter_core, jupyter_core.paths, jupyter_core.version, keyword,
linecache, locale, logging, logging.handlers, lzma, marshal,
math, mimetypes, multiprocessing, multiprocessing.connection,
multiprocessing.context, multiprocessing.process,
multiprocessing.reduction, multiprocessing.util, ntpath,
numbers, opcode, operator, optparse, os, os.path, pathlib, pdb,
pexpect, pexpect.exceptions, pexpect.expect, pexpect.pty_spawn,
pexpect.run, pexpect.spawnbase, pexpect.utils, pickle,
pickleshare, pkg_resources, pkg_resources._vendor,
pkg_resources._vendor.packaging.__about__,
pkg_resources._vendor.six, pkg_resources._vendor.six.moves,
pkg_resources.extern, pkg_resources.extern.appdirs,
pkg_resources.extern.packaging,
pkg_resources.extern.packaging._compat,
pkg_resources.extern.packaging._structures,
pkg_resources.extern.packaging.markers,
pkg_resources.extern.packaging.requirements,
pkg_resources.extern.packaging.specifiers,
pkg_resources.extern.packaging.version,
pkg_resources.extern.pyparsing, pkg_resources.extern.six,
pkg_resources.extern.six.moves,
pkg_resources.extern.six.moves.urllib, pkgutil, platform,
plistlib, posix, posixpath, pprint, profile, prompt_toolkit,
prompt_toolkit.application, prompt_toolkit.auto_suggest,
prompt_toolkit.buffer, prompt_toolkit.buffer_mapping,
prompt_toolkit.cache, prompt_toolkit.clipboard,
prompt_toolkit.clipboard.base,
prompt_toolkit.clipboard.in_memory, prompt_toolkit.completion,
prompt_toolkit.document, prompt_toolkit.enums,
prompt_toolkit.eventloop, prompt_toolkit.eventloop.base,
prompt_toolkit.eventloop.callbacks, prompt_toolkit.filters,
prompt_toolkit.filters.base, prompt_toolkit.filters.cli,
prompt_toolkit.filters.types, prompt_toolkit.filters.utils,
prompt_toolkit.history, prompt_toolkit.input,
prompt_toolkit.interface, prompt_toolkit.key_binding,
prompt_toolkit.key_binding.bindings,
prompt_toolkit.key_binding.bindings.basic,
prompt_toolkit.key_binding.bindings.completion,
prompt_toolkit.key_binding.bindings.emacs,
prompt_toolkit.key_binding.bindings.named_commands,
prompt_toolkit.key_binding.bindings.scroll,
prompt_toolkit.key_binding.bindings.utils,
prompt_toolkit.key_binding.bindings.vi,
prompt_toolkit.key_binding.digraphs,
prompt_toolkit.key_binding.input_processor,
prompt_toolkit.key_binding.manager,
prompt_toolkit.key_binding.registry,
prompt_toolkit.key_binding.vi_state, prompt_toolkit.keys,
prompt_toolkit.layout, prompt_toolkit.layout.containers,
prompt_toolkit.layout.controls, prompt_toolkit.layout.dimension,
prompt_toolkit.layout.lexers, prompt_toolkit.layout.margins,
prompt_toolkit.layout.menus,
prompt_toolkit.layout.mouse_handlers,
prompt_toolkit.layout.processors, prompt_toolkit.layout.prompt,
prompt_toolkit.layout.screen, prompt_toolkit.layout.toolbars,
prompt_toolkit.layout.utils, prompt_toolkit.mouse_events,
prompt_toolkit.output, prompt_toolkit.reactive,
prompt_toolkit.renderer, prompt_toolkit.search_state,
prompt_toolkit.selection, prompt_toolkit.shortcuts,
prompt_toolkit.styles, prompt_toolkit.styles.base,
prompt_toolkit.styles.defaults, prompt_toolkit.styles.from_dict,
prompt_toolkit.styles.from_pygments,
prompt_toolkit.styles.utils, prompt_toolkit.terminal,
prompt_toolkit.terminal.vt100_input,
prompt_toolkit.terminal.vt100_output, prompt_toolkit.token,
prompt_toolkit.utils, prompt_toolkit.validation, pstats, pty,
ptyprocess, ptyprocess.ptyprocess, ptyprocess.util, pwd, pydoc,
pyexpat, pyexpat.errors, pyexpat.model, pygments,
pygments.filter, pygments.filters, pygments.formatter,
pygments.formatters, pygments.formatters._mapping,
pygments.formatters.html, pygments.lexer, pygments.lexers,
pygments.lexers._mapping, pygments.lexers.python,
pygments.modeline, pygments.plugin, pygments.regexopt,
pygments.style, pygments.styles, pygments.styles.default,
pygments.token, pygments.unistring, pygments.util, queue,
quopri, random, re, reprlib, resource, runpy, select, selectors,
shlex, shutil, signal, simplegeneric, site, six, six.moves,
socket, sqlite3, sqlite3.dbapi2, sre_compile, sre_constants,
sre_parse, stat, storemagic, string, struct, subprocess, sys,
sysconfig, tarfile, tempfile, termios, textwrap, threading,
time, timeit, token, tokenize, tornado, tornado.concurrent,
tornado.escape, tornado.ioloop, tornado.log, tornado.platform,
tornado.platform.auto, tornado.platform.interface,
tornado.platform.posix, tornado.speedups, tornado.stack_context,
tornado.util, traceback, traitlets, traitlets._version,
traitlets.config, traitlets.config.application,
traitlets.config.configurable, traitlets.config.loader,
traitlets.log, traitlets.traitlets, traitlets.utils,
traitlets.utils.bunch, traitlets.utils.getargspec,
traitlets.utils.importstring, traitlets.utils.sentinel, tty,
types, typing, typing.io, typing.re, unicodedata, urllib,
urllib.parse, uuid, warnings, wcwidth, wcwidth.table_wide,
wcwidth.table_zero, wcwidth.wcwidth, weakref, xml, xml.parsers,
xml.parsers.expat, xml.parsers.expat.errors,
xml.parsers.expat.model, zipfile, zipimport, zlib, zmq,
zmq.backend, zmq.backend.cython, zmq.backend.cython._device,
zmq.backend.cython._poll, zmq.backend.cython._version,
zmq.backend.cython.constants, zmq.backend.cython.context,
zmq.backend.cython.error, zmq.backend.cython.message,
zmq.backend.cython.socket, zmq.backend.cython.utils,
zmq.backend.select, zmq.error, zmq.eventloop,
zmq.eventloop.ioloop, zmq.eventloop.zmqstream, zmq.libzmq,
zmq.sugar, zmq.sugar.attrsettr, zmq.sugar.constants,
zmq.sugar.context, zmq.sugar.frame, zmq.sugar.poll,
zmq.sugar.socket, zmq.sugar.stopwatch, zmq.sugar.tracker,
zmq.sugar.version, zmq.utils, zmq.utils.constant_names,
zmq.utils.jsonapi, zmq.utils.strtypes

Built-in Modules


In [3]:
import sys
import textwrap
name_text = ', '.join(sorted(sys.builtin_module_names))
print(textwrap.fill(name_text, width=64))


_ast, _codecs, _collections, _functools, _imp, _io, _locale,
_operator, _signal, _sre, _stat, _string, _symtable, _thread,
_tracemalloc, _warnings, _weakref, atexit, builtins, errno,
faulthandler, gc, itertools, marshal, posix, pwd, sys, time,
xxsubtype, zipimport

Import Path


In [4]:
import sys
for d in sys.path:
    print(d)


/Users/gaufung/anaconda/lib/python36.zip
/Users/gaufung/anaconda/lib/python3.6
/Users/gaufung/anaconda/lib/python3.6/lib-dynload
/Users/gaufung/anaconda/lib/python3.6/site-packages
/Users/gaufung/anaconda/lib/python3.6/site-packages/Sphinx-1.5.1-py3.6.egg
/Users/gaufung/anaconda/lib/python3.6/site-packages/aeosa
/Users/gaufung/anaconda/lib/python3.6/site-packages/PyImageQualityRanking-0.1-py3.6.egg
/Users/gaufung/anaconda/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg
/Users/gaufung/anaconda/lib/python3.6/site-packages/torchvision-0.1.8-py3.6.egg
/Users/gaufung/anaconda/lib/python3.6/site-packages/IPython/extensions
/Users/gaufung/.ipython

Importing from a shelve


In [5]:
import shelve
import os

filename = '/tmp/pymotw_import_example.shelve'
if os.path.exists(filename + '.db'):
    os.unlink(filename + '.db')
with shelve.open(filename) as db:
    db['data:README'] = b"""
==============
package README
==============

This is the README for ``package``.
"""
    db['package.__init__'] = b"""
print('package imported')
message = 'This message is in package.__init__'
"""
    db['package.module1'] = b"""
print('package.module1 imported')
message = 'This message is in package.module1'
"""
    db['package.subpackage.__init__'] = b"""
print('package.subpackage imported')
message = 'This message is in package.subpackage.__init__'
"""
    db['package.subpackage.module2'] = b"""
print('package.subpackage.module2 imported')
message = 'This message is in package.subpackage.module2'
"""
    db['package.with_error'] = b"""
print('package.with_error being imported')
raise ValueError('raising exception to break import')
"""
    print('Created {} with:'.format(filename))
    for key in sorted(db.keys()):
        print('  ', key)


Created /tmp/pymotw_import_example.shelve with:
   data:README
   package.__init__
   package.module1
   package.subpackage.__init__
   package.subpackage.module2
   package.with_error

In [6]:
import imp
import os
import shelve
import sys


def _mk_init_name(fullname):
    """Return the name of the __init__ module
    for a given package name.
    """
    if fullname.endswith('.__init__'):
        return fullname
    return fullname + '.__init__'


def _get_key_name(fullname, db):
    """Look in an open shelf for fullname or
    fullname.__init__, return the name found.
    """
    if fullname in db:
        return fullname
    init_name = _mk_init_name(fullname)
    if init_name in db:
        return init_name
    return None


class ShelveFinder:
    """Find modules collected in a shelve archive."""

    _maybe_recursing = False

    def __init__(self, path_entry):
        # Loading shelve causes an import recursive loop when it
        # imports dbm, and we know we are not going to load the
        # module # being imported, so when we seem to be
        # recursing just ignore the request so another finder
        # will be used.
        if ShelveFinder._maybe_recursing:
            raise ImportError
        try:
            # Test the path_entry to see if it is a valid shelf
            try:
                ShelveFinder._maybe_recursing = True
                with shelve.open(path_entry, 'r'):
                    pass
            finally:
                ShelveFinder._maybe_recursing = False
        except Exception as e:
            print('shelf could not import from {}: {}'.format(
                path_entry, e))
            raise
        else:
            print('shelf added to import path:', path_entry)
            self.path_entry = path_entry
        return

    def __str__(self):
        return '<{} for {!r}>'.format(self.__class__.__name__,
                                      self.path_entry)

    def find_module(self, fullname, path=None):
        path = path or self.path_entry
        print('\nlooking for {!r}\n  in {}'.format(
            fullname, path))
        with shelve.open(self.path_entry, 'r') as db:
            key_name = _get_key_name(fullname, db)
            if key_name:
                print('  found it as {}'.format(key_name))
                return ShelveLoader(path)
        print('  not found')
        return None


class ShelveLoader:
    """Load source for modules from shelve databases."""

    def __init__(self, path_entry):
        self.path_entry = path_entry
        return

    def _get_filename(self, fullname):
        # Make up a fake filename that starts with the path entry
        # so pkgutil.get_data() works correctly.
        return os.path.join(self.path_entry, fullname)

    def get_source(self, fullname):
        print('loading source for {!r} from shelf'.format(
            fullname))
        try:
            with shelve.open(self.path_entry, 'r') as db:
                key_name = _get_key_name(fullname, db)
                if key_name:
                    return db[key_name]
                raise ImportError(
                    'could not find source for {}'.format(
                        fullname)
                )
        except Exception as e:
            print('could not load source:', e)
            raise ImportError(str(e))

    def get_code(self, fullname):
        source = self.get_source(fullname)
        print('compiling code for {!r}'.format(fullname))
        return compile(source, self._get_filename(fullname),
                       'exec', dont_inherit=True)

    def get_data(self, path):
        print('looking for data\n  in {}\n  for {!r}'.format(
            self.path_entry, path))
        if not path.startswith(self.path_entry):
            raise IOError
        path = path[len(self.path_entry) + 1:]
        key_name = 'data:' + path
        try:
            with shelve.open(self.path_entry, 'r') as db:
                return db[key_name]
        except Exception:
            # Convert all errors to IOError
            raise IOError()

    def is_package(self, fullname):
        init_name = _mk_init_name(fullname)
        with shelve.open(self.path_entry, 'r') as db:
            return init_name in db

    def load_module(self, fullname):
        source = self.get_source(fullname)

        if fullname in sys.modules:
            print('reusing module from import of {!r}'.format(
                fullname))
            mod = sys.modules[fullname]
        else:
            print('creating a new module object for {!r}'.format(
                fullname))
            mod = sys.modules.setdefault(
                fullname,
                imp.new_module(fullname)
            )

        # Set a few properties required by PEP 302
        mod.__file__ = self._get_filename(fullname)
        mod.__name__ = fullname
        mod.__path__ = self.path_entry
        mod.__loader__ = self
        # PEP-366 specifies that package's set __package__ to
        # their name, and modules have it set to their parent
        # package (if any).
        if self.is_package(fullname):
            mod.__package__ = fullname
        else:
            mod.__package__ = '.'.join(fullname.split('.')[:-1])

        if self.is_package(fullname):
            print('adding path for package')
            # Set __path__ for packages
            # so we can find the sub-modules.
            mod.__path__ = [self.path_entry]
        else:
            print('imported as regular module')

        print('execing source...')
        exec(source, mod.__dict__)
        print('done')
        return mod

In [8]:
import sys



def show_module_details(module):
    print('  message    :', module.message)
    print('  __name__   :', module.__name__)
    print('  __package__:', module.__package__)
    print('  __file__   :', module.__file__)
    print('  __path__   :', module.__path__)
    print('  __loader__ :', module.__loader__)


filename = '/tmp/pymotw_import_example.shelve'
sys.path_hooks.append(sys_shelve_importer.ShelveFinder)
sys.path.insert(0, filename)

print('Import of "package":')
import package

print()
print('Examine package details:')
show_module_details(package)

print()
print('Global settings:')
print('sys.modules entry:')
print(sys.modules['package'])


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-8-6761d2b0f575> in <module>()
     13 
     14 filename = '/tmp/pymotw_import_example.shelve'
---> 15 sys.path_hooks.append(sys_shelve_importer.ShelveFinder)
     16 sys.path.insert(0, filename)
     17 

NameError: name 'sys_shelve_importer' is not defined

Importer Cache


In [9]:
import os
import sys

prefix = os.path.abspath(sys.prefix)

print('PATH:')
for name in sys.path:
    name = name.replace(prefix, '...')
    print(' ', name)

print()
print('IMPORTERS:')
for name, cache_value in sys.path_importer_cache.items():
    if '..' in name:
        name = os.path.abspath(name)
    name = name.replace(prefix, '...')
    print('  {}: {!r}'.format(name, cache_value))


PATH:
  
  .../lib/python36.zip
  .../lib/python3.6
  .../lib/python3.6/lib-dynload
  .../lib/python3.6/site-packages
  .../lib/python3.6/site-packages/Sphinx-1.5.1-py3.6.egg
  .../lib/python3.6/site-packages/aeosa
  .../lib/python3.6/site-packages/PyImageQualityRanking-0.1-py3.6.egg
  .../lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg
  .../lib/python3.6/site-packages/torchvision-0.1.8-py3.6.egg
  .../lib/python3.6/site-packages/IPython/extensions
  /Users/gaufung/.ipython

IMPORTERS:
  .../lib/python36.zip: None
  .../lib/python3.6: FileFinder('/Users/gaufung/anaconda/lib/python3.6')
  .../lib/python3.6/encodings: FileFinder('/Users/gaufung/anaconda/lib/python3.6/encodings')
  .../lib/python3.6/lib-dynload: FileFinder('/Users/gaufung/anaconda/lib/python3.6/lib-dynload')
  .../lib/python3.6/collections: FileFinder('/Users/gaufung/anaconda/lib/python3.6/collections')
  .../lib/python3.6/site-packages: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages')
  .../lib/python3.6/site-packages/Sphinx-1.5.1-py3.6.egg: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/Sphinx-1.5.1-py3.6.egg')
  .../lib/python3.6/site-packages/aeosa: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/aeosa')
  .../lib/python3.6/site-packages/PyImageQualityRanking-0.1-py3.6.egg: <zipimporter object "/Users/gaufung/anaconda/lib/python3.6/site-packages/PyImageQualityRanking-0.1-py3.6.egg">
  .../lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg: <zipimporter object "/Users/gaufung/anaconda/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg">
  .../lib/python3.6/site-packages/torchvision-0.1.8-py3.6.egg: <zipimporter object "/Users/gaufung/anaconda/lib/python3.6/site-packages/torchvision-0.1.8-py3.6.egg">
  /Users/gaufung/WorkSpace/PythonStandardLibrary/RunningFeatures/sys: FileFinder('/Users/gaufung/WorkSpace/PythonStandardLibrary/RunningFeatures/sys')
  .../lib/python3.6/importlib: FileFinder('/Users/gaufung/anaconda/lib/python3.6/importlib')
  .../lib/python3.6/site-packages/ipykernel: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/ipykernel')
  .../lib/python3.6/json: FileFinder('/Users/gaufung/anaconda/lib/python3.6/json')
  .../lib/python3.6/site-packages/IPython: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/IPython')
  .../lib/python3.6/site-packages/IPython/core: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/IPython/core')
  .../lib/python3.6/site-packages/IPython/extensions: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/IPython/extensions')
  .../lib/python3.6/site-packages/traitlets: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/traitlets')
  .../lib/python3.6/site-packages/traitlets/utils: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/traitlets/utils')
  .../lib/python3.6/site-packages/ipython_genutils: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/ipython_genutils')
  .../lib/python3.6/site-packages/traitlets/config: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/traitlets/config')
  .../lib/python3.6/urllib: FileFinder('/Users/gaufung/anaconda/lib/python3.6/urllib')
  .../lib/python3.6/site-packages/IPython/utils: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/IPython/utils')
  .../lib/python3.6/site-packages/pygments: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/pygments')
  .../lib/python3.6/site-packages/IPython/testing: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/IPython/testing')
  .../lib/python3.6/site-packages/pexpect: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/pexpect')
  .../lib/python3.6/site-packages/ptyprocess: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/ptyprocess')
  .../lib/python3.6/site-packages/IPython/terminal: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/IPython/terminal')
  .../lib/python3.6/site-packages/IPython/lib: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/IPython/lib')
  .../lib/python3.6/site-packages/pygments/lexers: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/pygments/lexers')
  .../lib/python3.6/xml: FileFinder('/Users/gaufung/anaconda/lib/python3.6/xml')
  .../lib/python3.6/xml/parsers: FileFinder('/Users/gaufung/anaconda/lib/python3.6/xml/parsers')
  .../lib/python3.6/email: FileFinder('/Users/gaufung/anaconda/lib/python3.6/email')
  .../lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources: <zipimporter object "/Users/gaufung/anaconda/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/">
  .../lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/extern: <zipimporter object "/Users/gaufung/anaconda/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/extern/">
  .../lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/_vendor: <zipimporter object "/Users/gaufung/anaconda/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/_vendor/">
  .../lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/_vendor/packaging: <zipimporter object "/Users/gaufung/anaconda/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/_vendor/packaging/">
  : FileFinder('.')
  .../lib/python3.6/site-packages/pygments/formatters: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/pygments/formatters')
  .../lib/python3.6/sqlite3: FileFinder('/Users/gaufung/anaconda/lib/python3.6/sqlite3')
  .../lib/python3.6/site-packages/prompt_toolkit: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/prompt_toolkit')
  .../lib/python3.6/site-packages/prompt_toolkit/filters: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/prompt_toolkit/filters')
  .../lib/python3.6/site-packages/wcwidth: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/wcwidth')
  .../lib/python3.6/site-packages/prompt_toolkit/key_binding: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/prompt_toolkit/key_binding')
  .../lib/python3.6/site-packages/prompt_toolkit/clipboard: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/prompt_toolkit/clipboard')
  .../lib/python3.6/site-packages/prompt_toolkit/key_binding/bindings: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/prompt_toolkit/key_binding/bindings')
  .../lib/python3.6/site-packages/prompt_toolkit/layout: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/prompt_toolkit/layout')
  .../lib/python3.6/site-packages/prompt_toolkit/styles: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/prompt_toolkit/styles')
  .../lib/python3.6/site-packages/pygments/styles: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/pygments/styles')
  .../lib/python3.6/site-packages/prompt_toolkit/eventloop: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/prompt_toolkit/eventloop')
  .../lib/python3.6/site-packages/prompt_toolkit/terminal: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/prompt_toolkit/terminal')
  .../lib/python3.6/site-packages/IPython/core/magics: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/IPython/core/magics')
  .../lib/python3.6/site-packages/jupyter_client: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/jupyter_client')
  .../lib/python3.6/ctypes: FileFinder('/Users/gaufung/anaconda/lib/python3.6/ctypes')
  .../lib/python3.6/site-packages/zmq: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/zmq')
  .../lib/python3.6/site-packages/zmq/backend: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/zmq/backend')
  .../lib/python3.6/site-packages/zmq/backend/cython: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/zmq/backend/cython')
  .../lib/python3.6/site-packages/zmq/utils: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/zmq/utils')
  .../lib/python3.6/site-packages/zmq/sugar: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/zmq/sugar')
  .../lib/python3.6/site-packages/jupyter_core: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/jupyter_core')
  .../lib/python3.6/ctypes/macholib: FileFinder('/Users/gaufung/anaconda/lib/python3.6/ctypes/macholib')
  .../lib/python3.6/site-packages/zmq/eventloop: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/zmq/eventloop')
  .../lib/python3.6/site-packages/tornado: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/tornado')
  .../lib/python3.6/logging: FileFinder('/Users/gaufung/anaconda/lib/python3.6/logging')
  .../lib/python3.6/html: FileFinder('/Users/gaufung/anaconda/lib/python3.6/html')
  .../lib/python3.6/concurrent: FileFinder('/Users/gaufung/anaconda/lib/python3.6/concurrent')
  .../lib/python3.6/concurrent/futures: FileFinder('/Users/gaufung/anaconda/lib/python3.6/concurrent/futures')
  .../lib/python3.6/multiprocessing: FileFinder('/Users/gaufung/anaconda/lib/python3.6/multiprocessing')
  .../lib/python3.6/site-packages/tornado/platform: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/tornado/platform')
  .../lib/python3.6/site-packages/jupyter_client/blocking: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/jupyter_client/blocking')
  .../lib/python3.6/site-packages/ipykernel/comm: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/ipykernel/comm')
  /Users/gaufung/.ipython: FileFinder('/Users/gaufung/.ipython')
  /Users/gaufung/.ipython/extensions: FileFinder('/Users/gaufung/.ipython/extensions')
  .../lib/python3.6/site-packages/ipywidgets: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/ipywidgets')
  .../lib/python3.6/site-packages/ipywidgets/widgets: FileFinder('/Users/gaufung/anaconda/lib/python3.6/site-packages/ipywidgets/widgets')
  .../lib/python3.6/dbm: FileFinder('/Users/gaufung/anaconda/lib/python3.6/dbm')